﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace FzWeb.Models
{
    public class PostSearch
    {

        /*数据库端参数
         * @VocationId varchar(300)=null,             --行业类型 VARCHAR  '1,2,3'
@PostClassId varchar(300)=null,            --职位类型 VARCHAR  '1,2,3'
@WorkAreaId varchar(300)=null,             --工作地区 VARCHAR  '1,2,3'
@PostDate int=null,                        --发布日期 INT 1
@WorkLength int =null,                     --工作年限 INT 1
@Education varchar(30)=null,               --学历     VARCHAR   '博士'
@keyWord varchar(50)=null,             --关键字   varchar  
@keyWordType int=null,                      --搜索范围 int       标志  1-全文    2-职位名称    3-公司名称
@PostType varchar(30)=null,                --岗位性质 varchar   例子:'全职,兼职'
@CompanyType varchar(50)=null,             --公司性质
@Sex int=null,                             --性别
@SalaryFrom int=null,                      --工资要求（范围）  '1500'
@SalaryTo   int=null
         */
        private string _VocationId;

        public string VocationId
        {
            get { return _VocationId; }
            set { _VocationId = value; }
        }
        private string _PostClassId;

        public string PostClassId
        {
            get { return _PostClassId; }
            set { _PostClassId = value; }
        }
        private string _LocationId;

        public string LocationId
        {
            get { return _LocationId; }
            set { _LocationId = value; }
        }
        private int _PostDate;

        public int PostDate
        {
            get { return _PostDate; }
            set { _PostDate = value; }
        }
        private int _WorkLength;

        public int WorkLength
        {
            get { return _WorkLength; }
            set { _WorkLength = value; }
        }
        private string _Education;

        public string Education
        {
            get { return _Education; }
            set { _Education = value; }
        }
        private string _keyWord;

        public string keyWord
        {
            get { return _keyWord; }
            set { _keyWord = value; }
        }
        private int _keyWordType;

        public int keyWordType
        {
            get { return _keyWordType; }
            set { _keyWordType = value; }
        }
        private string _PostType;

        public string PostType
        {
            get { return _PostType; }
            set { _PostType = value; }
        }
        private string _CompanyType;

        public string CompanyType
        {
            get { return _CompanyType; }
            set { _CompanyType = value; }
        }
        private int _Sex;

        public int Sex
        {
            get { return _Sex; }
            set { _Sex = value; }
        }
        private int _SalaryFrom;

        public int SalaryFrom
        {
            get { return _SalaryFrom; }
            set { _SalaryFrom = value; }
        }
        private int _SalaryTo;

        public int SalaryTo
        {
            get { return _SalaryTo; }
            set { _SalaryTo = value; }
        }

        private string _VocationName;

        public string VocationName
        {
            get { return _VocationName; }
            set { _VocationName = value; }
        }
        private string _PostClassName;

        public string PostClassName
        {
            get { return _PostClassName; }
            set { _PostClassName = value; }
        }
        private string _Location;

        public string Location
        {
            get { return _Location; }
            set { _Location = value; }
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            if (!string.IsNullOrEmpty(VocationName))
            {
                sb.Append(VocationName);
            }
            if (!string.IsNullOrEmpty(PostClassName))
            {
                sb.Append(" + "+PostClassName);
            }
            if (!string.IsNullOrEmpty(Location))
            {
                sb.Append(" + " + Location);
            }
            if (PostDate!=0)
            {
                sb.Append(" + " + PostDate +"天内");
            }
            if (WorkLength!=0)
            {
                sb.Append(" + " + WorkLength +"年以上");
            }
            if (!string.IsNullOrEmpty(Education))
            {
                sb.Append(" + " + Education);
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                sb.Append(" + " + keyWord + "(" + ((keyWordType == 0) ? "全文" : keyWordType == 1 ? "岗位名" : "公司名") + ")");
            }
            if (!string.IsNullOrEmpty(PostType))
            {
                string[] str = PostType.Split(',');
                string s = (str[0] == "'true'" ? "全职," : "") + (str[1] == "'true'" ? "兼职," : "") + (str[2] == "'true'" ? "实习" : "");
                sb.Append(" + " + s);
            }
            return sb.ToString();
        }
    }
}
